//https://leetcode.cn/problems/0jQkd0/


func minimumSwitchingTimes(source [][]int, target [][]int) int {
	m := len(source)
	n := len(source[0])
	rec := make(map[int]int)
	for i := 0; i < m; i++ {
		for j := 0;j < n; j++ {
			rec[source[i][j]]--
			rec[target[i][j]]++
		}
	}
	ans := 0
	for _, v := range rec {
		if v > 0 {
			ans += v
		}
	}
	return ans
}